#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main(void)
{
	int N, i, m, d = 0, M, n;
	int arr1[20] = { 0 }, arr2[20] = { 0 }, arr3[40] = { 0 };
	scanf_s("%d", &N);
	for (i = 0; i < N; i++)
		scanf_s("%d", &arr1[i]);
	scanf_s("%d", &M);
	for (i = 0; i < M; i++)
		scanf_s("%d", &arr2[i]);
	for (i = 0; i < N; i++)
		for (m = 0; m < M; m++)
		{
			if (arr1[i] == arr2[m])
				break;
			else if (arr1[i] != arr2[m] && m == M - 1)
			{

				arr3[d] = arr2[i];
				d++;
				if (d > 0)
				{
					for (n = 0; n < d; n++)
					{
						if (arr1[i] == arr3[n])
							break;
						if (n == d)
						{
							arr3[d] = arr2[i];
							d++;
						}
					}
				}

			}
		}


	for (i = 0; i < M; i++)
		for (m = 0; m < N; m++)
		{
			if (arr2[i] == arr1[m])
				break;
			else if (arr2[i] != arr1[m] && m == N - 1)
			{
				for (n = 0; n < d; n++)
				{
					if (arr2[i] == arr3[n])
						break;
					if (n == d)
					{
						arr3[d] = arr2[i];
						d++;
					}
				}
			}
		}
	printf("%d", arr3[0]);
	for (i = 1; i < d; i++)
		printf(" %d", arr3[i]);
	return 0;

}
